<template>
	<view class="shop-index">
		<cu-custom bgColor="bg-gradual-orange" :isBack="true">
			<block slot="content">商家中心</block>
		</cu-custom>

		<view class="shop-top">
			<!-- <view class="shop-top-bg-one"></view>
			<view class="shop-top-bg-two"></view> -->

			<view class="shop-top-bg-one">
				<my-home-slide v-if="slides.length" :isHome="isHome" :slides="slides" :height="'500rpx'"
					:mode="'scaleToFill'"></my-home-slide>
			</view>
			<view class="shop-top-bg-two"></view>
		</view>
		<view class="shop-bottom">
			<view class="shop-item" @tap="jumpTo('/pages/my/shop/qrcode', 'inside', true)">
				<view class="item-img">
					<image src="/static/shop/index/1.png" mode="aspectFill"></image>
				</view>
				<view class="item-text">收款码</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
				<!-- <image class="item-more" src="../../../static/shop_more.png" mode=""></image> -->
			</view>
			<view class="shop-item" @tap="jumpTo('/pages/my/shop/order', 'inside', true)">
				<view class="item-img">
					<image src="/static/shop/index/2.png" mode="aspectFill">
				</view>
				<view class="item-text">营收统计</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
				<!-- <image class="item-more" src="../../../static/shop_more.png" mode=""></image> -->
			</view>
			<!-- <view class="shop-item" @tap="jumpTo('/pages/my/shop/discount', 'inside', true)">
				<view class="item-img"><image src="../../../static/userorders.png" mode=""></image></view>
				<view class="item-text">折扣券管理</view>
					<view class="item-more">
						<text class="cuIcon-right"></text>
					</view>
			</view> -->
			<view class="shop-item" @tap="jumpTo('/pages/my/shop/rebate', 'inside', true)">
				<view class="item-img">
					<image src="/static/shop/index/3.png" mode="aspectFill">
				</view>
				<view class="item-text">商家收益</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
				<!-- <image class="item-more" src="../../../static/shop_more.png" mode=""></image> -->
			</view>
			<view class="shop-item" @tap="jumpTo('/pages/my/shop/fans', 'inside', true)">
				<view class="item-img">
					<image src="/static/shop/index/4.png" mode="aspectFill">
				</view>
				<view class="item-text">商家粉丝</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
				<!-- <image class="item-more" src="../../../static/shop_more.png" mode=""></image> -->
			</view>
			<!-- v-if="!shop.wx_mchid" -->
			<view class="shop-item" @tap="jumpTo('/pages/shipment/index', 'inside', true)">
				<view class="item-img">
					<image src="/static/shop/index/5.png" mode="aspectFill">
				</view>
				<view class="item-text">商户进件</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="shop-item" @tap="jumpTo('/pages/shipment/Qrcode', 'inside', true)">
				<view class="item-img">
					<image src="/static/shop/index/5.png" mode="aspectFill">
				</view>
				<view class="item-text">商家签约查询码</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="shop-item" @tap="jumpTo('/pages/my/shop/profile', 'inside', true)">
				<view class="item-img">
					<image src="/static/shop/index/6.png" mode="aspectFill">
				</view>
				<view class="item-text">修改资料</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
				<!-- <image class="item-more" src="../../../static/shop_more.png" mode=""></image> -->
			</view>
			<!-- <view class="shop-item" @tap="jumpTo('/pages/my/shop/adverted', 'inside', true)">
				<view class="item-img shop_06"><image src="../../../static/shop_06.png" mode="" style="width: 25.8px;height: 28.8px;"></image></view>
				<view class="item-text">收款广告投放</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
			</view> -->
			<!-- <view class="shop-item" @tap="jumpTo('/pages/my/shop/commission', 'inside', true)">
				<view class="item-img shop_06"><image src="../../../static/shareicon.png" mode=""></image></view>
				<view class="item-text">商户分享佣金</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
			</view> -->
			<!-- <view class="shop-item" @tap="jumpTo('/pages/my/shop/equipment', 'inside', true)">
				<view class="item-img shop_06"><image src="../../../static/equicon.png" mode=""></image></view>
				<view class="item-text">语音播报绑定</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
			</view> -->
			<view class="shop-item" @tap="jumpTo('/pages/my/shop/setting', 'inside', true)">
				<view class="item-img shop_06">
					<image src="/static/shop/index/7.png" mode="aspectFill">
				</view>
				<view class="item-text">活动配置</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="shop-item" @tap="jumpTo('/pages/my/shop/users', 'inside', true)">
				<view class="item-img">
					<image src="/static/shop/index/8.png" mode="aspectFill">
				</view>
				<view class="item-text">消费用户</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
				<!-- <image class="item-more" src="../../../static/shop_more.png" mode=""></image> -->
			</view>
			<view class="shop-item" @tap="addGoods()">
				<view class="item-img shop_06">
					<image src="/static/shop/index/9.png" mode="aspectFill">
				</view>
				<view class="item-text">发布商品</view>
				<view class="item-more">
					<text class="cuIcon-right"></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import MyHomeSlide from "@/components/MyHomeSlide";
	import api from '@/api/';
	import shop from '@/api/shop.js';
	export default {
		data() {
			return {
				slides: [],
				isHome: 'isShop',
				shop: {
					wx_mchid: ''
				},
			}
		},
		components: {
			MyHomeSlide
		},
		onLoad() {
			this.loadIndex();
		},
		methods: {
			addGoods() {
				// #ifdef H5
				location.href = 'https://www.yycjkb.cn/index/user/login.html'
				// #endif

				// #ifdef APP-PLUS

				plus.runtime.openUrl('https://www.yycjkb.cn/index/user/login.html')

				// #endif
			},
			async loadIndex() {
				var type = 'shop';
				api.index({
					type: type
				}).then(res => {
					if (res.code === 1) {
						this.slides = res.data.list;
					} else {
						this.toast(res.msg);
					}
				});

				shop.index().then(res => {
					if (res.code === 1) {
						this.shop = res.data.shop;
					} else {
						this.toast(res.msg);
					}
				});
			},
		}
	}
</script>

<style lang="less">
	page {
		background: #fff;
	}


	.shop-index {
		// height: 100vh;
		background: #fff;

		.shop-top {
			background-image: linear-gradient(45deg, #ff9700, #fee12e);
			// background: url(../../../static/my_bg.png) no-repeat center center;
			height: 270px;
			border-top: 1px solid transparent;
			position: relative;

			.shop-top-bg-one {
				height: 155px;
				margin: 25px 15px 0;
				// background: url(../../../static/shop_bg.png) no-repeat center center;
				background-size: 100%;
				border-radius: 4px;
				position: absolute;
				left: 0;
				right: 0;
				top: 0;
				z-index: 11;
			}

			.shop-top-bg-two {
				height: 60px;
				// background: #E9EFEF;
				position: relative;
				top: 130px;
				z-index: 1;
			}
		}

		.shop-bottom {
			margin-top: -10px;
			background: #fff;
			height: 100px;
			position: relative;
			z-index: 0;
			border-radius: 4px;
			padding: 40px 15px 0 15px;

			.shop-item {
				padding: 8px 20px;
				display: flex;
				border-bottom: 1px solid #DFDFDF;
				position: relative;

				.item-img {
					width: 32px;
					height: 32px;

					image {
						height: 90%;
						width: 90%;
					}
				}

				.shop_06 {
					image {
						height: 96%;
						width: 90%;
					}
				}

				.item-text {
					font-size: 15px;
					font-weight: bold;
					line-height: 32px;
					padding: 0 10px;
				}

				.item-more {
					width: 13px;
					height: 19px;
					position: absolute;
					right: 20px;
					top: 50%;
					transform: translateY(-50%);

					text {
						color: #929292;
						font-size: 35rpx;
						font-weight: 600;
					}
				}
			}
		}
	}
</style>